home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / answers / comp / x-faq / speedups < prev    next >
Internet Message Format  |  1994-04-15  |  33KB

  1. Path: bloom-beacon.mit.edu!grapevine.lcs.mit.edu!uhog.mit.edu!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cyber2.cyberstore.ca!nntp.cs.ubc.ca!alberta!art
  2. From: art@cs.ualberta.ca (Art Mulder)
  3. Newsgroups: comp.windows.x,news.answers,comp.answers
  4. Subject: comp.windows.x: Getting more performance out of X.  FAQ
  5. Followup-To: poster
  6. Date: 15 Apr 1994 14:39:48 GMT
  7. Organization: Computing Science, U of Alberta, Edmonton, Canada
  8. Lines: 741
  9. Approved: news-answers-request@MIT.Edu
  10. Expires: 20 May 94 23:00:00 GMT
  11. Message-ID: <2om8vk$6hp@scapa.cs.ualberta.ca>
  12. Reply-To: art@cs.ualberta.ca (Art Mulder)
  13. NNTP-Posting-Host: spirit-riv.cs.ualberta.ca
  14. Summary: This posting contains a list of suggestions about what you can do to get the best performance out of X on your workstation -- without buying more hardware.
  15. Keywords: FAQ speed X
  16. Xref: bloom-beacon.mit.edu comp.windows.x:23711 news.answers:18078 comp.answers:4917
  17.  
  18. Archive-name: x-faq/speedups
  19. Last-modified: 1994/03/10
  20.  
  21. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  22.     HOW TO MAXIMIZE THE PERFORMANCE OF X -- monthly posting
  23. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  24.         Compiled by Art Mulder (art@cs.ualberta.ca)
  25.  
  26.   More RAM, Faster CPU's, More disk space, Faster Ethernet....  These
  27.   are the standard responses you hear when you ask how to improve the
  28.   performance of your workstation.
  29.  
  30.   Well, more hardware isn't always an option, and I wonder if more
  31.   hardware is always even a necessity.
  32.  
  33.   This "FAQ" list is a collection of suggestions and ideas from different
  34.   people on the net on how you can the best possible performance from X
  35.   Windows on your workstation, WITHOUT PURCHASING MORE HARDWARE.
  36.  
  37.   Performance is a highly subjective issue.  The individual user must
  38.   balance `speed' versus `features' in order to come to a personal
  39.   decision.  Therefore this document can be be expected to contain many
  40.   subjective opinions in and amongst the objective facts.
  41.  
  42.   This document is specifically concerned with X.  There are of course
  43.   many other factors that can affect the performance of a workstation.
  44.   However, they are outside the scope of this document.
  45.  
  46.     [ People seriously interested in the whole area of system
  47.     performance, might want to look at the O'Reilly Nutshell Handbook
  48.     "System Performance Tuning" by Mike Loukides.  IMHO, it contains a
  49.     well-written, comprehensive treatment of system performance.  I
  50.     refer to it a lot.  I'm unaware of any other similar books.  --ed.]
  51.  
  52. -----------------
  53. Table of Contents
  54. -----------------
  55.   0. Introduction & Administrivia
  56.   1. Window Managers
  57.   2. The X Server
  58.        Which Server?
  59.        Locking the Server into RAM?
  60.        Starting your Server
  61.        Fonts
  62.        About the Resources File
  63.        Define Your Display Properly
  64.   3. Clients
  65.        A Better Clock for X
  66.        A Better Terminal Emulator for X
  67.        Other Client Comments
  68.        Tuning your client
  69.   4. Miscellaneous Suggestions
  70.        Pretty Pictures
  71.        A Quicker Mouse
  72.        Programming Thoughts
  73.        Say What!?
  74.   5. Other Sources of Information
  75.        The "Other X FAQ"
  76.        Books & etc.
  77.   6. Author & Notes
  78.   
  79. ! = changed since last issue.
  80. * = new since last issue.
  81.  
  82. -----------------------------
  83. Introduction & Administrivia
  84. -----------------------------
  85.  
  86.   This document is posted each month, on or around the 15th, to the
  87.   Usenet news groups comp.windows.x, news.answers, and comp.answers.
  88.   If you are reading a copy of this FAQ which is more than a few
  89.   months old (see the "Last-modified" date above) you should probably
  90.   locate the latest edition, since the information may be outdated.
  91.  
  92.   If you do not know how to get those newsgroups and/or your site does
  93.   not receive them and/or this article has already expired, you can
  94.   retrieve this FAQ from an archive site.
  95.  
  96.   There exist several usenet FAQ archive sites.  To find out more about
  97.   them and how to access them, please see the "Introduction to the
  98.   news.answers newsgroup" posting in news.answers.
  99.  
  100.   The main FAQ archive is at rtfm.mit.edu.  This document can be found
  101.   there in /pub/usenet/news.answers/x-faq/speedups.  If you do not have
  102.   access to anonymous ftp, you can retrieve it by sending a mail
  103.   message to mail-server@rtfm.mit.edu with the command "send
  104.   usenet/news.answers/x-faq/speedups" in the message body.
  105.  
  106. ---------------
  107. Window Managers
  108. ---------------
  109.  
  110.   There are a lot of window managers out there, with lots of different
  111.   features and abilities.  The choice of which to use is by necessity a
  112.   balancing act between performance and useful features.  At this
  113.   point, most respondents have agreed upon "twm" as the best candidate
  114.   for a speedy window manager. 
  115.  
  116.   A couple of generic tricks you can try to soup up your window manger,
  117.   is turning off unnecessary things like "zooming" and "opaque move".
  118.   Also, if you lay out your windows in a tiled manner, you reduce the
  119.   amount of cpu power spent in raising and lowering overlapping
  120.   windows.                           Joe English (joe@trystero.art.com)
  121.  
  122.   I've found that a good font for tiling is 7x13 (aka:
  123.   -misc-fixed-medium-r-normal--13-100-100-100-c-70-iso8859-1 ). It is
  124.   the biggest font I know of that I can use on my Sun (1152x900 screen)
  125.   and still get two 80 column terminal windows side-by-side on the
  126.   display with no overlap.  Other font suggestions will be accepted.
  127.  
  128. Suggestions for your consideration:
  129.  
  130.   Linux'ers and others might want a look at fvwm.  A light-weight
  131.   virtual wm, targeted at ``machines with too little memory, at laptops
  132.   on which mouse usage may be awkward, and at users who prefer the
  133.   appearance of the Motif window manager to twm ... all wm functions
  134.   can be performed w/out a mouse'' [from the README].
  135.                                    Zack Evans (zevans@nyx.cs.du.edu)
  136.  
  137.   While originally developed for Linux, fvwm will compile on a number
  138.   of different platforms.  The fvwm docs claim a memory consumption of
  139.   about 1/3 to 2/3 that of twm.
  140.  
  141.   Speaking personally, fvwm may consume less memory but I found that it
  142.   `feels' slower than twm.  (For example: grab a window - I use opaque
  143.   move - and drag it around the screen.  Twm has a very snappy
  144.   response, but with fvwm v1.05 the window was lagging way behind the
  145.   pointer.  This comparison was done on two identical Sun SLC's)
  146.   However, I will also grant that fvwm is a young piece of software
  147.   that is being rapidly updated & improved so these concerns may soon
  148.   be fixed.                                                      [ed]
  149.  
  150. ------------ 
  151. The X Server
  152. ------------
  153.  
  154. Which Server?
  155. - - - - - - -
  156.   Make sure that your server is a proper match for your hardware.
  157.   If you have a monochrome monitor, use a monochrome X11 server.
  158.  
  159.   On my Monochrome Sun, I haven't noticed much difference between
  160.   the Xsun (colour) server and XsunMono, however it was pointed out to
  161.   me that XsunMono is about 800k smaller and therefore should contribute
  162.   to less paging.  
  163.          [ thanks to: Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk),
  164.                         Michael Salmon (Michael.Salmon@eos.ericsson.se) ]
  165.  
  166.   How your server was compiled can also make a difference.  Jeff Law
  167.   (law@schirf.cs.utah.edu) advises us that on a Sun system, X should be
  168.   compiled with gcc (version 2.*) or with the unbundled Sun compiler.
  169.   You can expect to get "*very* large speedups in the server" by not
  170.   using the bundled SunOS compiler.  I assume that similar results
  171.   would occur if you used one of the other high-quality commercial
  172.   compilers on the market.
  173.  
  174. Locking the Server into RAM?
  175. - - - - - - - - - - - - - - -
  176.   It was suggested that perhaps hacking the X server so that it would
  177.   stay locked in RAM (and therefore not get paged out) might help
  178.   performances.  eg: via a call to plock().
  179.        [Eric C Claeys (ecc@eperm.att.com), Danny Backx (db@sunbim.be),
  180.     Juan D. Martin (juando@cnm.us.es)]
  181.  
  182.   Kenny Ranerup [kenny@axis.se] tried this a few years ago and
  183.   confirmed that it does work, and can give a noticeable speedup.  But,
  184.   you must be careful that your server doesn't grow too large (ie,
  185.   close to the size of your RAM).  He also makes the point that slow
  186. rformace is in many cases due to client paging (paging
  187.   in libraries), and not server paging.
  188.  
  189. Starting your Server
  190. - - - - - - - - - - -
  191.   Joe English (joe@trystero.art.com) :
  192.     If you start up a lot of clients in your .xsession or whatever, sleep
  193.     for a second or two after launching each one.  After I changed my
  194.     .xclients script to do this, logging in actually took *less* time...
  195.     we have a heavily loaded system without much core, though.
  196.  
  197.   This sounds crazy, but I have confirmed that it works!  
  198.  
  199.   Warner Losh (imp@Boulder.ParcPlace.COM) provided me with a good
  200.   explanation of why this works, which I have summarized here:
  201.  
  202.     When you start up an X server it takes a huge amount of time to
  203.     start accepting connections.  A lot of initialization is done by
  204.     the server when it starts.  This process touches a large number of
  205.     pages.  Any other process running at the same time would fight the
  206.     server for use of the CPU, and more importantly, memory.  If you
  207.     put a sleep in there, you give the Server a chance to get itself
  208.     sorted out before the clients start up.
  209.  
  210.     Similarly, there is also a lot of initialization whenever an X
  211.     client program starts: toolkits registering widgets, resources
  212.     being fetched, programs initializing state and "databases" and so
  213.     forth.  All this activity is typically memory intensive.  Once this
  214.     initialization is done ("The process has reached a steady state"),
  215.     the memory usage typically settles down to using only a few pages.
  216.     By using sleeps to stagger the launching of your clients in your
  217.     .Xinitrc , you avoid them fighting each other for your
  218.     workstation's limited resources
  219.  
  220.   This is most definitely a "Your Mileage May Vary" situation, as there
  221.   are so many variables to be considered: available RAM, local swap
  222.   space, load average, number of users on your system, which clients
  223.   you are starting, etc.
  224.  
  225.   Currently in my .xinitrc I have a situation like:
  226.     (sleep 1; exec xclock ) &
  227.     (sleep 1; exec xbiff ) &
  228.     (sleep 1; exec xterm ) &
  229.     (sleep 1; exec xterm ) &
  230.  
  231.   I've experimented with:
  232.     (sleep 1; exec xclock ) &
  233.     (sleep 2; exec xbiff ) &
  234.     (sleep 3; exec xterm ) &
  235.     (sleep 4; exec xterm ) &
  236.  
  237.   I've even tried:
  238.     (sleep 2; exec start_X_clients_script ) &
  239.   and then in start_X_clients_script I had:
  240.     (sleep 1; exec xclock ) &
  241.     (sleep 1; exec xbiff ) &
  242.     (sleep 1; exec xterm ) &
  243.     (sleep 1; exec xterm ) &
  244.  
  245.     [ The idea with this last one was to make sure that xinit had
  246.     completely finished processing my .xinitrc, and had settled down
  247.     into a "steady state" before the sleep expired and all my clients
  248.     were launched. ]
  249.  
  250.   All of these yielded fairly comparable results, and so I just stuck with
  251.   my current setup, for its simplicity.  You will probably have to
  252.   experiment a bit to find a setup which suits you.
  253.  
  254. Fonts
  255. - - -
  256.   Loading fonts takes time and RAM.  If you minimize the number of fonts
  257.   your applications use, you'll get speed increases in load-up time.
  258.  
  259.   One simple strategy is to choose a small number of fonts (one small, one
  260.   large, one roman, whatever suits you) and configure all your clients -- or
  261.   at least all your heavily used clients -- to use only those few fonts.
  262.   Client programs should start up quicker if their font is already loaded
  263.   into the server.  This will also conserve server resources, since fewer
  264.   fonts will be loaded by the server.
  265.                   [ Farrell McKay (fbm@ptcburp.ptcbu.oz.au),
  266.                     Joe English (joe@trystero.art.com) ]
  267.  
  268.   eg: My main xterm font is 7x13, so I also have twm set up to use 7x13
  269.   in all it's menus and icons etc.  Twm's default font is 8x13.  Since
  270.   I don't normally use 8x13, I've eliminated one font from my server.
  271.  
  272.   Oliver Jones (oj@roadrunner.pictel.com):
  273.     Keep fonts local to the workstation, rather than loading them over nfs.
  274.     If you will make extensive use of R5 scalable fonts, use a font server.
  275.  
  276. About the Resources File
  277. - - - - - - - - - - - - -
  278.  
  279.     Keep your .Xresources / .Xdefaults file small.  Saves RAM and saves
  280.     on server startup time.          Joe English (joe@trystero.art.com)
  281.  
  282.   One suggestion:
  283.  
  284.     In your .Xresources file, try putting only the minimum number of
  285.     resources that you want to have available to all of your
  286.     applications.  For example:  *reverseVideo: true
  287.  
  288.     Then, separate your resources into individual client-specific
  289.     resource files.  For example: $HOME/lib/app-defaults.  In your
  290.     .login file set the environment variable XUSERFILESEARCHPATH:
  291.  
  292.     setenv XUSERFILESEARCHPATH $HOME/lib/app-defaults/%N
  293.  
  294.     (Note:  It is easier and quicker for Xt to process
  295.     XUSERFILESEARCHPATH than XAPPLRESDIR.)
  296.  
  297.     [ The "comp.windows.x Frequently Asked Questions" FAQ contains
  298.     an excellent explanation of how this and the other main X
  299.     environment variables work.  --ed.]
  300.  
  301.     So, when xterm launches, it loads its resources from
  302.     .../app-defaults/XTerm.  Xdvi finds them in .../app-defaults/XDvi,
  303.     and so on and so forth.  Note that not all clients follow the same
  304.     XXxxx resource-file naming pattern.  You can check in your system
  305.     app-defaults directory (often: /usr/X11R5/lib/X11/app-defaults/) to
  306.     find the proper name, and then name your personal resource files
  307.     with the same name.
  308.  
  309.     This is all documented in the Xt Specification (pg 125 & 666).
  310.             [Thanks to: Kevin Samborn (samborn@mtkgc.com),
  311.                  Michael Urban (urban@cobra.jpl.nasa.gov),
  312.              Tom Bagli (tomb@gator.bocaraton.ibm.com),
  313.                      and Mike Long (mikel@ee.cornell.edu).
  314.          Kevin is willing mail his setup files to inquirers.]
  315.  
  316.   This method of organizing your personal resources has the following
  317.   benefits:
  318.  
  319.     - Easier to maintain / more usable.
  320.  
  321.     - Fewer resources are stored in the X server in the RESOURCE_MANAGER
  322.       property.  As a side benefit your server may start fractionally
  323.       quicker, since it doesn`t have to load all your resources.
  324.  
  325.     - Applications only process their own resources, never have to sort 
  326.       through all of your resources to find the ones that affect them.
  327.  
  328.   It also has drawbacks:
  329.  
  330.     - the application that you are interested in has to load an
  331.       additional file every time it starts up.  This doesn't seem to
  332.       make that much of a performance difference, and you might
  333.       consider this a huge boon to usability.  If you are modifying an
  334.       application's resource database, you just need to re-run the
  335.       application without having to "xrdb" again.
  336.  
  337.     - xrdb will by default run your .Xresources file through cpp.  When
  338.       your resources are split out into multiple resource files and
  339.       then loaded by the individual client programs, they will not.
  340.       WATCH OUT FOR THIS!!
  341.  
  342.       I had C style comments in my .Xresources file, which cpp stripped
  343.       out.  When I switched to this method of distributed resource
  344.       files I spent several frustrating days trying to figure out why
  345.       my clients were not finding their resources.  Xt did *NOT*
  346.       provide any error message when it encountered the C style
  347.       comments in the resource files, it simply, silently, aborted
  348.       processing the resource file.
  349.  
  350.       The loss of preprocessing (which can be very handy, e.g. ``#ifdef
  351.       COLOR'' ...) is enough to cause some people to dismiss this
  352.       method of resource management.
  353.  
  354.     - You may also run into some clients which break the rules.  For
  355.       example, neither Emacs (18.58.3) nor Xvt (1.0) will find their
  356.       resources if they are anywhere other than in .Xresources.
  357.  
  358.     - when starting up a client on a machine that does not share files
  359.       with the machine where your resources are stored, your client
  360.       will not find its resources.  Loading all your resources into the
  361.       server will guarantee that all of your clients will always find
  362.       their resources.            Casey Leedom (casey@gauss.llnl.gov)
  363.  
  364.   A possible compromise that I have tried, is to put resources for all
  365.   my heavily used clients (eg: xterm) into my .Xresources file, and to
  366.   use the "separate resources files" method for clients that I seldom
  367.   use.
  368.  
  369. Define Your Display Properly
  370. - - - - - - -
  371.  
  372.   Client programs are often executed on the same machine as the server.  In
  373.   that situation, rather than setting your DISPLAY environment variable to 
  374.   "<hostname>:0.0", where <hostname> is the name of your workstation, you
  375.   should set your DISPLAY variable to "unix:0.0" or ":0.0".  By doing this
  376.   you access optimized routines that know that the server is on the same
  377.   machine and use a shared memory method of transferring requests.
  378.             [thanks to Patrick J Horgan (pjh70@ras.amdahl.com)]
  379.  
  380.   See the _DISPLAY NAMES_ section of the X(1) man page for further
  381.   explanation of how to properly set your display name.
  382.  
  383.   "I don't think it's stock MIT, but (at least) Data General and HP have
  384.   libraries that are smart enough to use local communication even when
  385.   the DISPLAY isn't set specially."
  386.                   Rob Sartin (88opensi!sartin@uunet.UU.NET)
  387.  
  388.   [Jody Goldberg (jody@algorithmics.com) sent me an Xlib patch to change
  389.   stock R5 to use local communication even if DISPLAY is not properly set.
  390.   I don't want to get in the business of distributing or trying to juggle
  391.   non-MIT patches and so have elected not to include it here.  Hopefully MIT
  392.   will apply this minor (~8 lines) patch themselves.  In the meantime, if
  393.   you want to try it yourself, email Jody.  --ed.]
  394.  
  395. -------
  396. Clients
  397. -------
  398.  
  399.   If you only have a few megabytes of Ram then you should think
  400.   carefully about the number of programs you are running.  Think also
  401.   about the _kind_ of programs you are running.  For example:  Is there
  402.   a smaller clock program than xclock?
  403.  
  404.   Unfortunately, I haven't really noticed that programs advertise how large
  405.   they are, so the onus is on us to do the research and spread the word.
  406.  
  407.   [ Suggestions on better alternatives to the some of the standard clients
  408.   (eg: Xclock, Xterm, Xbiff) are welcome.  --ed.]
  409.  
  410.   I've received some contradictory advice from people, on the subject
  411.   of X client programs.  Some advocate the use of programs that are
  412.   strictly Xlib based, since Xt, Xaw and other toolkits are rather
  413.   large.  Others warn us that other applications which you are using
  414.   may have already loaded up one or more of these shared libraries.  In
  415.   this case, using a non-Xt (for example) client program may actually
  416.   _increase_ the amount of RAM consumed.
  417.  
  418.   The upshot of all this seems to be: Don't mix toolkits.  That is, try
  419.   and use just Athena clients, or just Xview clients (or just Motif
  420.   clients, etc).  If you use more than one, then you're dragging in
  421.   more than one toolkit library.
  422.  
  423.   Know your environment, and think carefully about which client
  424.   programs would work best together in that environment.
  425.  
  426.           [Thanks to: Rob Sartin (88opensi!sartin@uunet.UU.NET),
  427.       Duncan Sinclair (sinclair@dcs.gla.ac.uk | sinclair@uk.ac.gla.dcs) ]
  428.  
  429. A Better Clock for X
  430. - - - - - - - - - - -
  431.  
  432. 1) xcuckoo
  433.    suggested by: Duncan Sinclair (sinclair@dcs.gla.ac.uk)
  434.    available: on export.lcs.mit.edu
  435.  
  436.    Xcuckoo displays a clock in the title bar of *another* program.
  437.    Saves screen real estate.
  438.  
  439. 2) mclock
  440.    suggested by: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  441.    available: larry.mcrcim.mcgill.edu (132.206.1.1) in /X/mclock.shar
  442.  
  443.    Non Xt-based.  Extensively configurable.  it can be made to look
  444.    very much like MIT oclock, or mostly like xclock purely by changing
  445.    resources.
  446.  
  447.   Of course, the ultimate clock --- one that consumes no resources, and 
  448.   takes up no screen real estate --- is the one that hangs on your wall.
  449.   :-) 
  450.  
  451. A Better Terminal Emulator for X
  452. - - - - - - - - - - - - - - - - -
  453.  
  454.   From the README file distributed with xterm:
  455.  
  456.   +-----
  457.   |         Abandon All Hope, Ye Who Enter Here
  458.   |
  459.   | This is undoubtedly the most ugly program in the distribution.
  460.   | ...
  461.   +-----
  462.  
  463.   Ugly maybe, but at my site it's still the most used.  I suspect that
  464.   xterm is one of the most used clients at many, if not most sites.
  465.   Laziness?  Isn't there a better terminal emulator available?  See below.
  466.  
  467.   If you must use xterm, you can try reducing the number of saveLines
  468.   to reduce memory usage.  [ Oliver Jones (oj@roadrunner.pictel.com),
  469.            Jonny Farringdon (j.farringdon@psychol.ucl.ac.uk) ]
  470.  
  471. 1) Xvt
  472.    Suggested by: Richard Hesketh (rlh2@ukc.ac.uk)
  473.    Author: John D. Bovey (jdb@ukc.ac.uk)
  474.    Available: export.lcs.mit.edu in /contrib/xvt-1.0.tar.Z
  475.  
  476.    [From the README file] "Xvt is an X terminal-emulator that is
  477.    designed to be more or less compatible with xterm while using much
  478.    less swap space.  It is mainly intended for use at sites which use
  479.    large numbers of X terminals but may also be useful on single
  480.    workstations that are short of memory.  On a [SunOS 4.1.* Sparc], an
  481.    initially invoked xvt uses about 1/3 megabyte of swap while xterm
  482.    uses about 1.3 megabytes (obtained by running pstat rather than ps
  483.    which seems to give unreliable size figures on SPARCs).  The main
  484.    way that xvt achieves its small size is by avoiding the use of the X
  485.    toolkit."
  486.  
  487.    Since it is a partial 'clone' of xterm, you don't have to rename
  488.    your resources, as xvt pretends to be "XTerm".  In it's current
  489.    version, you cannot bind keys as you can in xterm.  I've heard that
  490.    there are versions of xvt with this feature, but I've not found any
  491.    yet.
  492.  
  493.    UPDATE (Oct 1993):  John Bovey tells me that a new version of xvt is
  494.    in the works that should have some of the most frequently missed
  495.    xterm features.
  496.  
  497.    There have been some conflicting opinions aired over xvt vs. xterm.
  498.    Different sites with different needs will likely have to do
  499.    their own evaluation.  Caveat Emptor, your mileage may vary.
  500.  
  501.    I have seen hard data from J.Bovey showing how xvt does in fact
  502.    require less swap space than xterm.  However, both of us would still
  503.    like to see any other benchmarks that people can provide comparing
  504.    the two.  (eg: How much RAM each occupies, relative speed of each.)
  505.  
  506. 2) rxvt
  507.    Suggested by: Zack Evans (zevans@nyx.cs.du.edu)
  508.    Author: Rob Nation (nation@rocket.sanders.lockheed.com)
  509.  
  510.    Apparently a stripped down Linux port of xvt, with some 
  511.    minor modifications. 
  512.  
  513. 3) mterm
  514.    Suggested by/Author: der Mouse (mouse@Lightning.McRCIM.McGill.EDU)
  515.    Available: larry.mcrcim.mcgill.edu (132.206.1.1) in
  516.      /X/mterm.src/mterm.ball-o-wax.
  517.  
  518.    "I also have my own terminal emulator.  Its major lack is
  519.    scrollback, but some people like it anyway."
  520.  
  521. Other Client Comments
  522. - - - - - - - - - - -
  523.   When using the xlock screen locking client, the "qix" mode is
  524.   much more lightweight than the default mode.  
  525.                  [Q. Alex Zhao (azhao@cc.gatech.edu)]
  526.  
  527.   I can confirm the previous report from personal experience  here.  In
  528.   a lab full of ~20 sun 3/80's all running the Xkernel software, the
  529.   subnet was getting regularly clobbered.  This was tracked down to
  530.   students running xlock.  Since these machines are all xterminals, the
  531.   actual xlock program runs remotely, and generates a scary amount of
  532.   network traffic to draw the default 'swarm' pictures on the screen.
  533.   We have removed this program and replaced it with a much simpler
  534.   screen locking program which simply blanks the screen.        [ed.]
  535.  
  536.   An improved xbiff: Xbuffy.  It can watch multiple mailboxes and can
  537.   do a pop up showing the From and Subject line of incoming mail.
  538.   Xbiff doesn't eat much memory and Xbuffy tends to be about the same
  539.   (on the RS/6000, xbuffy tends use just a little less memory).  It is
  540.   in the contrib directory on ftp.x.org.
  541.                                [ Bill Pemberton (wfp5p@virginia.edu) ]
  542.  
  543. Tuning your client
  544. - - - - - - - - - -
  545.  
  546.   Suggestions on how you can tune your client programs to work faster.
  547.  
  548.   From Scott Barman (scott@asd.com) comes a suggestion regarding Motif
  549.   Text Field Widgets:
  550.  
  551.     I noticed that during data entry into Motif text field widgets, I
  552.     was getting a slight lag in response to some keystrokes,
  553.     particularly the initial one in the field.  Examining the what was
  554.     going on with xscope I found it.  It seems that when the resource
  555.     XmNblinkRate is non-zero and the focus is on a text field widget
  556.     (or even just a text widget) the I-beam cursor will blink.
  557. , the
  558.     widget code is making a request to the server (CopyArea).  The user
  559.     can stop this by setting the resource XmNblinkRate to 0.  It is not
  560.     noticeable on a 40MHz SPARC, but it does make a little difference
  561.     on a [slower system].
  562.  
  563.   This specific suggestion can probably be applied in general to lots
  564.   of areas.  Consider your heavily used clients, are there any minor
  565.   embellishments that can be turned off and thereby save on Server
  566.   requests?
  567.  
  568. -------------------------
  569. Miscellaneous Suggestions
  570. -------------------------
  571.  
  572. Pretty Pictures
  573. - - - - - - - -
  574.   Don't use large bitmaps (GIF's, etc) as root window backgrounds.
  575.  
  576.   - The more complicated your root window bitmap, the slower the server
  577.     is at redrawing your screen when you reposition windows (or redraw, etc)
  578.  
  579.   - These take up RAM, and CPU power.  I work on a Sun SPARC and I'm
  580.     conscious of performance issues, I can't comprehend it when I see
  581.     people with a 4mb Sun 3/60 running xphoon as their root window.
  582.  
  583.     I'll let someone else figure out how much RAM would be occupied by
  584.     having a full screen root image on a colour workstation.
  585.  
  586.   - If you're anything like me, you need all the screen real estate
  587.     that you can get for clients, and so rarely see the root window anyway.
  588.  
  589.               [ Thanks to Qiang Alex Zhao (azhao@cs.arizona.edu) 
  590.             for reminding me of this one. --ed.]
  591.  
  592. A Quicker Mouse
  593. - - - - - - - -
  594.   Using xset, you can adjust how fast your pointer moves on the screen
  595.   when you move your mouse.  I use "xset m 3 10" in my .xinitrc file,
  596.   which lets me send my pointer across the screen with just a flick of
  597.   the wrist.  See the xset man page for further ideas and information.
  598.  
  599.   Hint: sometimes you may want to *slow down* your mouse tracking for
  600.   fine work.  To cover my options, I have placed a number of different
  601.   mouse setting commands into a menu in my window manager.  
  602.  
  603.   e.g. (for twm) :
  604.       menu "mouse settings" {
  605.         "Mouse Settings:"            f.title
  606.     "  Very Fast"                ! "xset m 7 10 &"
  607.     "  Normal (Fast)"            ! "xset m 3 10 &"
  608.     "  System Default (Un-Accelerated)"    ! "xset m default &"
  609.     "  Glacial"                ! "xset m 0 10 &"
  610.       }
  611.  
  612. Programming Thoughts
  613. - - - - - - - - - - -
  614.   Joe English (joe@trystero.art.com) :
  615.     To speed up applications that you're developing, there are tons of
  616.     things you can do.  Some that stick out:
  617.  
  618.     - For Motif programs, don't set XmFontList resources for individual
  619.       buttons, labels, lists, et. al.; use the defaultFontList or
  620.       labelFontList or whatever resource of the highest-level manager
  621.       widget.  Again, stick to as few fonts as possible.
  622.  
  623.     - Better yet, don't use Motif at all.  It's an absolute pig.
  624.  
  625.     - Don't create and destroy widgets on the fly.  Try to reuse them.
  626.       (This will avoid many problems with buggy toolkits, too.)
  627.  
  628.     - Use a line width of 0 in GCs.  On some servers this makes a HUGE
  629.       difference.
  630.  
  631.     - Compress and collapse multiple Expose events.  This can make the
  632.       difference between a fast application and a completely unusable
  633.       one.
  634.  
  635.   Francois Staes (frans@kiwi.uia.ac.be) :
  636.     Just a small remark: I once heard that using a better malloc
  637.     function would greatly increase performance of Xt based
  638.     applications since they use malloc heavily. They suggested trying
  639.     out the GNUY malloc, but I didn't find the time yet. I did some
  640.     tests on small programs just doing malloc and free, and the
  641.     differences were indeed very noticeable ( somewhat 5 times faster)
  642.  
  643.   [ Any confirmation on this from anyone?  --ed.]
  644.  
  645.   Andre' Beck (Andre_Beck@IRS.Inf.TU-Dresden.de) :
  646.  
  647.   - Unnecessary NoExpose Events.
  648.  
  649.     Most people use XCopyArea/XCopyPlane as fastest blit routines, but
  650.     they forget to reset graphics_exposures in the GC used for the
  651.     blits. This will cause a NoExpose Event every blit, that, in most
  652.     cases, only puts load onto the connection and forces the client to
  653.     run through it's event-loop again and again.
  654.  
  655.   - Thousands of XChangeGC requests.
  656.  
  657.     This "Gfx Context Switching" is also seen in most handcoded X-Apps,
  658.     where only one or few GCs are created and then heavily changed
  659.     again and again.  Xt uses a definitely better mechanism, by caching
  660.     and sharing a lot of GCs with all needed parameters. This will
  661.     remove the load of subsequent XChangeGC requests from the
  662.     connection (by moving it toward the client startup phase).
  663.  
  664. Say What!?
  665. - - - - - - 
  666.   Some contributors proposed ideas that seem right off the wall at first:
  667.  
  668.   David B. Lewis (by day: dbl@osf.org, by night: david%craft@uunet.uu.net) :
  669.     How about this: swap displays with someone else. Run all your programs
  670.     on the other machine and display locally; the other user runs off your
  671.     machine onto the other display. Goal: reduce context switches in the
  672.     same operation between client and server.
  673.  
  674.   I'm not in a situation where I can easily try this, but I have received
  675.   the following confirmation...
  676.  
  677.   Michael Salmon (Michael.Salmon@eos.ericsson.se):
  678.     I regularly run programs on other machines and I notice a big
  679.     difference. I try to run on a machine where I will reduce net usage
  680.     and usually with nice to reduce the impact of my intrusion. This
  681.     helps a lot on my poor little SS1+ with only 16 MB, it was
  682.     essential when I only had 8 MB.
  683.  
  684.   Casey Leedom (casey@gauss.llnl.gov) :
  685.     [The X11 Server and the client are] competing for the same CPU as
  686.     your server when you run it on the same machine.  Not really a
  687.     major problem, except that the X11 client and the server are in
  688.     absolute synchronicity and are context thrashing.
  689.  
  690.   Timothy H Panton (thp@westhawk.uucp) :
  691.     Firstly it relies on the fact that most CPU's are mostly idle, X's
  692.     cpu usage is bursty.  so the chances of you and your teammate
  693.     doing something cpu-intensive at the same time is small. If they
  694.     are not then you get twice the cpu+memory available for your
  695.     action.
  696.  
  697.     The second factor is that context switches are expensive, using 2
  698.     cpu's halves them, you pay a price due to the overhead of going
  699.     over the network, but this is offset in most cases by the improved
  700.     buffering of a network (typically 20k vs 4k for a pipe), allowing
  701.     even fewer context switches.
  702.  
  703. ----------------------------
  704. Other Sources of Information
  705. ----------------------------
  706.  
  707. The "Other X FAQ"
  708. - - - - - - - - -
  709.  
  710.   David B. Lewis (faq%craft@uunet.uu.net) maintains the informative and
  711.   well written "comp.windows.x Frequently Asked Questions" document.
  712.   Its focus is on general X information, while this FAQ concentrates
  713.   on performance.
  714.  
  715.   The comp.windows.x FAQ does address the issue of speed, but only with
  716.   regards to the X server.  The gist of that topic seems to be:
  717.     "Use X11R5, it is faster than R4".
  718.   (Please see the X FAQ for complete details).
  719.  
  720. Books & etc.
  721. - - - - - - -
  722.  
  723.   Volume 8 in O'Reilly's X Window System Series; ``X Window System
  724.   Administrator's Guide'' is a book that all X administrator's should
  725.   read.
  726.  
  727.   Adrian Nye (adrian@ora.com):
  728.     A lot more tips on performance are in the paper "Improving X
  729.     Application Performance" by Chris D. Peterson and Sharon Chang, in
  730.     Issue 3 of The X Resource.
  731.  
  732.     An earlier version of this paper appeared in the Xhibition 1992
  733.     conference proceedings.
  734.  
  735.     This paper is absolutely essential reading for X programmers.
  736.  
  737. --------------
  738. Author & Notes
  739. --------------
  740.   This list is currently maintained by Art Mulder (art@cs.ualberta.ca)
  741.  
  742.   Suggestions, corrections, or submission for inclusion in this list
  743.   are gladly accepted.  Layout suggestions and comments (spelling
  744.   mistak's too! :-) are also welcome.
  745.  
  746.   Currently I have listed all contributors of the various comments and
  747.   suggestions.  If you do not want to be credited, please tell me.
  748.  
  749.   speedup-x-faq is copyright (c) 1993 by Arthur E. Mulder
  750.  
  751.   You may copy this document in whole or in part as long as you don't
  752.   try to make money off it, or pretend that you wrote it.
  753.  
  754. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  755. --
  756.  ...art mulder ( art@cs.ualberta.ca )    | "Do not be conformed to this world,
  757.  http:   |  but be transformed by the renewal
  758.  CS Dept, U of Alberta, Edmonton, Canada |  of your mind, ..."  Romans 12:2
  759.